<template>
    <base-panel>
        <top-simple-search @searchFun="getList" @addFun="toAdd">
        </top-simple-search>
    <simple-table ref="myTable" size="mini">
        <my-title-column align="left" prop="name" label="角色名" @click="toDetail">
        </my-title-column>
        <el-table-column prop="description" label="描述"/>
        <el-table-column prop="label" label="标签"/>
        <my-time-column prop="gmt_created" label="创建时间"/>
        <my-switch-column prop="status" label="是否显示"/>
        <my-switch-column prop="binding" label="是否绑定部门" width="120px"/>
        <el-table-column align="left" label="操作" width="220px">
            <template slot-scope="{row}">
                <detail-button @click="toDetail(row)"></detail-button>
                <edit-button @click="toEdit(row)" size="mini">修改</edit-button>
                <delete-button @click="toDelete(row.id)" size="mini">删除</delete-button>
                <my-button @click="showUserListDialog(row)" handle="fpyh">分配</my-button>
                <my-button @click="showDataScopeDialog(row)" handle="sjqx">权限</my-button>
            </template>
        </el-table-column>
    </simple-table>
      <detail-dialog  v-if="visible" :visible.sync="visible" :row="currRow" @reloadList="getList" :disabled="disabled"></detail-dialog>
      <user-list-dialog
        :visible.sync="roleUsersVisible"
        :id="currRow.id"
        v-if="roleUsersVisible"
      ></user-list-dialog>
    </base-panel>
</template>
<script>
    import simpleTable from "@/mixins/SimpleTable";
    import DetailDialog from "./DetailDialog";
    import MyTitleColumn from "@/components/TableColumn/MyTitleColumn";
    import MyTimeColumn from '../../../components/TableColumn/MyTimeColumn'
    import MySwitchColumn from '../../../components/TableColumn/MySwitchColumn'
    import UserListDialog from './UserListDialog'
    // 获取登录用户信息
    export default {
        components: { UserListDialog, MySwitchColumn, MyTimeColumn, MyTitleColumn, DetailDialog},
        mixins: [simpleTable],
        data(){
            return {
              roleUsersVisible:false
            }
        },
        methods:{
          showUserListDialog(row){
            this.roleUsersVisible = true
            this.currRow = row
          },
          showDataScopeDialog(row){
            this.$router.push({path:"roleAuthManagement",query:{id:row.id}})
          },
        }
    }
</script>
